
from playwright.sync_api import sync_playwright,expect
from time import sleep
import time

def test_A3mall_01():
    print("开始")
#初始化框架并启动后台
    with sync_playwright()as p:
        #打开浏览器p.firefox.launch
        #不要无头模式headless=False
        browser=p.firefox.launch(headless=False)
        #打开新的页面
        page=browser.new_page()
        #访问目标网址
        page.goto('http://10.59.9.12:7001/')
        #进行操作
        #点击去登录
        page.click('xpath = /html/body/div[1]/div/div[2]/ul/li[1]/a')
        time.sleep(4)
        #输入账号密码
        page.fill('xpath = //*[@id="theForm"]/div[1]/span[2]/input','13811033962')
        page.fill('xpath = //*[@id="theForm"]/div[2]/span[2]/input','123456')
        time.sleep(15)
        #点击登录按钮
        page.click('xpath = //*[@id="theForm"]/div[5]/a')
        time.sleep(5)

    print("结束")